<?php
session_start();
if(isset($_SESSION['admin_id'])) {
    include('../include/dbFunctions.php');
    $_SESSION['mes']="";
//Retrieve data from AJAX data sent by jEditable
$updateID = $_SESSION['admin_id'];

    $admin_name =  htmlspecialchars($_POST['admin_name'],ENT_QUOTES);
    $admin_email =  htmlspecialchars($_POST['admin_email'],ENT_QUOTES);
    $admin_password =  SHA1($_POST['admin_password']);
if($admin_password==SHA1('__________')){
$query1 = "UPDATE quanly
            SET admin_name = '".$admin_name."',
                admin_email = '".$admin_email."'
                    WHERE admin_id='".$updateID."'";
}else{
    $query1 = "UPDATE quanly
            SET admin_name = '".$admin_name."',
                admin_email = '".$admin_email."',
                admin_password = '".$admin_password."'
                    WHERE admin_id='".$updateID."'";
}

    $result1 = executeQuery($query1);
   if ($result1!=0) {
        $_SESSION['mes'] = "Your record has been updated successfully.";
    } else {
        $_SESSION['mes'] = "Error! Please try again";
    }$link = "../include/adminaccount.php";
    header("Location: $link ");

}else {
    header("Location: ../../include/login.html");
}
?>
